// src/types/http.ts
import type { AxiosRequestConfig, AxiosResponse } from "axios";
// 基础响应类型
export interface ApiResponse<T = any> {
  code: number;
  data: T;
  message: string;
  success: boolean;
  timestamp?: number;
}

// 分页响应类型
export interface PaginatedResponse<T = any> {
  items: T[];
  total: number;
  page: number;
  pageSize: number;
  totalPages: number;
}

// 错误类型
export interface ApiError {
  code: number;
  message: string;
  details?: any;
  config?: AxiosRequestConfig; // 添加 config 属性
  response?: AxiosResponse; // 添加 response 属性
  timestamp?: number;
}

// 请求配置
export interface RequestConfig {
  silent?: boolean; // 是否静默处理错误
  showLoading?: boolean; // 是否显示加载状态
  retryTimes?: number; // 重试次数
  key?: string; // 缓存键
  cacheKey?: string; // 缓存键
}
